#pragma once
#include "BBox.h"
#include "cObject.h"

#define ANIM_STILL 4
#define ANIM_IDLE 3
#define ANIM_RUN 2
#define ANIM_ATTACK 1
#define ANIM_DIE 0

struct BONE: public D3DXFRAME
{
	D3DXMATRIX CombinedTransformationMatrix;
};

struct BONEMESH: public D3DXMESHCONTAINER
{
	std::vector<D3DMATERIAL9> materials;
	std::vector<IDirect3DTexture9*> textures;
};

class cAniModel : public cObject
{
public:
	int life;

public:
	cAniModel();
	~cAniModel();
	void load( const char fileName[] );
	void render( BONE *bone = NULL );

	void animate( D3DXMATRIX world );
	int getAnimationCount();
	//void SetAnimation( int index );

	ID3DXAnimationController* getAnimationControl();

	BBox getBoundingBox()		{ return mBbox;		}
	BSphere getBoundingSphere() { return mBsphere;	}

private:
	void updateMatrices( BONE* bone, D3DXMATRIX *parentMatrix );

	D3DXFRAME				 *m_pRootBone;
	ID3DXAnimationController *m_pAnimControl;
	BBox				mBbox;
	BSphere				mBsphere;

private:
	void calcBBox();
	void calcBSphere();
};
